/*
 * HashNomi.c
 *
 *  Created on: Apr 29, 2012
 *      Author: georgios
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int hashCodeOfAString(char * str) {
	if (str == NULL) {
		return 0;
	}

	int len = strlen(str);
    int hashcode=0;
    int PRIME=10003;
    int shift=29;
    int i;
    for(i=0; i<len; i++) {
    	//hashcode=((shift * hashcode) % PRIME + x.charAt(i)) % PRIME;
    	hashcode=((shift * hashcode) % PRIME + str[i]) % PRIME;
    }
    return hashcode;
}

int hashvalueForArray(int n, int len) {
	return 0;
}

int hashInt(int a) {
	a += ~(a<<15);
	a ^=  (a>>10);
	a +=  (a<<3);
	a ^=  (a>>6);
	a += ~(a<<11);
	a ^=  (a>>16);
	return a;
}
